package com.manage.project.biz.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.project.biz.domain.BizTujianjieguoyingjijiancha;
import com.manage.project.biz.service.IBizTujianjieguoyingjijianchaService;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.web.page.TableDataInfo;

/**
 Controller
 *
 * @author liutao
 *
 */
@RestController
@RequestMapping("/biz/tujianjieguoyingjijiancha")
public class BizTujianjieguoyingjijianchaController extends BaseController
{
    @Autowired
    private IBizTujianjieguoyingjijianchaService bizTujianjieguoyingjijianchaService;

    /**
     * 查询应急检查列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjieguoyingjijiancha:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizTujianjieguoyingjijiancha bizTujianjieguoyingjijiancha)
    {
        startPage();
        List<BizTujianjieguoyingjijiancha> list = bizTujianjieguoyingjijianchaService.selectBizTujianjieguoyingjijianchaList(bizTujianjieguoyingjijiancha);
        return getDataTable(list);
    }

    /**
     * 导出应急检查列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjieguoyingjijiancha:export')")
    @Log(title = "应急检查", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizTujianjieguoyingjijiancha bizTujianjieguoyingjijiancha)
    {
        List<BizTujianjieguoyingjijiancha> list = bizTujianjieguoyingjijianchaService.selectBizTujianjieguoyingjijianchaList(bizTujianjieguoyingjijiancha);
        ExcelUtil<BizTujianjieguoyingjijiancha> util = new ExcelUtil<BizTujianjieguoyingjijiancha>(BizTujianjieguoyingjijiancha.class);
        return util.exportExcel(list, "应急检查数据");
    }

    /**
     * 获取应急检查详细信息
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjieguoyingjijiancha:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizTujianjieguoyingjijianchaService.selectBizTujianjieguoyingjijianchaById(id));
    }

    /**
     * 新增应急检查
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjieguoyingjijiancha:add')")
    @Log(title = "应急检查", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizTujianjieguoyingjijiancha bizTujianjieguoyingjijiancha)
    {

        return toAjax(bizTujianjieguoyingjijianchaService.insertBizTujianjieguoyingjijiancha(bizTujianjieguoyingjijiancha));
    }

    /**
     * 修改应急检查
     */
    @Log(title = "应急检查", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizTujianjieguoyingjijiancha bizTujianjieguoyingjijiancha)
    {
        return toAjax(bizTujianjieguoyingjijianchaService.updateBizTujianjieguoyingjijiancha(bizTujianjieguoyingjijiancha));
    }

    /**
     * 删除应急检查
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjieguoyingjijiancha:remove')")
    @Log(title = "应急检查", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizTujianjieguoyingjijianchaService.deleteBizTujianjieguoyingjijianchaByIds(ids));
    }
}
